package com.changli04.date;

import org.junit.Test;

import java.util.Calendar;



/*
*
*
* 常用方法:get(int field)/ set(int field,xx)/ add(int field,xx)/ getTime()/ setTime()
*
* */
public class CalendarTest {
    @Test
    public void test() {
        Calendar calendar = Calendar.getInstance();
        System.out.println(calendar.getClass());//class java.util.GregorianCalendar
        System.out.println(calendar.get(Calendar.DAY_OF_MONTH));
        System.out.println(calendar.get(Calendar.DAY_OF_YEAR));



//        add
        calendar.add(Calendar.DAY_OF_YEAR, 2);

        System.out.println(calendar.get(Calendar.DAY_OF_YEAR));
        calendar.set(Calendar.DAY_OF_YEAR, 2);
        System.out.println(calendar.get(Calendar.DAY_OF_YEAR));

    }
}
